package com.heima.article.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heima.article.mapper.ApArticleContentMapper;
import com.heima.article.mapper.ApArticleMapper;
import com.heima.article.service.ApArticleContentService;
import com.heima.model.article.pojos.ApArticleContent;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ApArticleContentServerImpl extends ServiceImpl<ApArticleContentMapper, ApArticleContent> implements ApArticleContentService {
    @Autowired
    private ApArticleContentMapper apArticleContentMapper;

    /**
     * 查询ApArticle获取id，再通过id查询ApArticleContent,获取content内容详情
     * @param id
     * @return
     */
    @Override

    public ApArticleContent ContentText(Long id) {
        QueryWrapper<ApArticleContent> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("article_id",id);
        ApArticleContent apArticleContent = apArticleContentMapper.selectOne(queryWrapper);
        return apArticleContent;
    }
}
